<%@ page import="com.hf.constant.OrderLunchConst"%>
<%@ page import="com.hf.fetch.FetchGroup"%>
<div>
	<p>
		<b>取餐列表参考: </b>
	</p>
	<table id="hor-minimalist">
		<thead>
			<tr>
				<th scope="col">No.</th>
				<th scope="col">User</th>
				<th scope="col">Group</th>
				<th scope="col">Ratio</th>
				<th scope="col">Fetched Count</th>
				<th scope="col">Ordered Count</th>
			</tr>
		</thead>
		<tbody>
			<g:each in="${fetchUserSummaryList}" var="userFetchSummary"
				status="i">
				<tr>
					<td>
						${i+1}
					</td>
					<td>
						${userFetchSummary?.user?.name}
					</td>
					<td>
						${userFetchSummary?.fetchGroup}
					</td>
					<td>
						${userFetchSummary?.ratio}
					</td>
					<td>
						${userFetchSummary?.allFetchedCount}
					</td>
					<td>
						${userFetchSummary?.allOrderedCount}
					</td>
				</tr>
			</g:each>
		</tbody>
	</table>

	<b>取餐友组:</b>
	<table id="hor-minimalist">
		<thead>
			<tr>
				<th scope="col">No.</th>
				<th scope="col">Group</th>
				<th scope="col">Friend Groups</th>
			</tr>
		</thead>
		<tbody>
			<g:each in="${FetchGroup.list(sort:'name')}" var="fetchGroup"
				status="i">
				<tr>
					<td>
						${i+1}
					</td>
					<td>
						${fetchGroup}
					</td>
					<td>
						${fetchGroup.friendGroups }
					</td>
				</tr>
			</g:each>
		</tbody>
	</table>

	<p>
		<b>表格说明: 按Ratio排列, Ratio 越大则取餐的可能行越高</b> <br />简单说就是: 订的越多, 取的越多 <br />当天取餐的人(为已订餐的人)为:
		<br />Step 1: 第一人(基准人): Ratio最大的一个人 <br />Step 2: 找其他的人,
		Ratio由高到低(过程中找齐则停止), 按以下优先级: <br />______(1) 与基准人<b>同组</b> <br />______(2)
		与基准人<b>友组</b> <br />Step 3: 若找不齐取餐的人, 基准人则为: Ratio第二大(递增)的人, 重复Step
		2,3
	</p>

	<p>
		<b>Ratio公式:</b> <br />Ratio = (Ordered Count+${OrderLunchConst.FETCH_RATIO_AJUST_ZERO })
		/ (Fetched Count+1)
	</p>

	<p>
		<b>取餐人数说明:</b> <br />1个人最多拿8份, 订餐1-8份 1人, 9-16份 2人, 以此类推 <br />如遇下雨,
		多加一人
	</p>
</div>